﻿<Window
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
        xmlns:SW2A311_Lib="clr-namespace:SW2A311_Lib;assembly=SW2A311" x:Name="BackgroundWindow" mc:Ignorable="d" x:Class="Client.MainWindow"
        xmlns:local="Client:MainWindow"
        Title="GanttMaker" d:DesignWidth="1024" d:DesignHeight="576" MinWidth="1024" MinHeight="576" SizeChanged="BackgroundWindow_SizeChanged" Closing="BackgroundWindow_Closing" KeyDown="BackgroundWindow_KeyDown" >
    <Window.Background>
        <LinearGradientBrush EndPoint="0.5,1" MappingMode="RelativeToBoundingBox" StartPoint="0.5,0">
            <GradientStop Color="{DynamicResource {x:Static SystemColors.ActiveCaptionColorKey}}" Offset="0.927"/>
            <GradientStop Color="#FFDADBDC"/>
            <GradientStop Color="#FED4DFEB" Offset="0.394"/>
        </LinearGradientBrush>
    </Window.Background>
    <Grid x:Name="MotherGrid" Margin="0" SnapsToDevicePixels="True">
        <Grid.ColumnDefinitions>
            <ColumnDefinition x:Name="LeftSideOfMotherGrid" Width="200"/>
            <ColumnDefinition x:Name="MiddleOfMotherGrid"/>
            <ColumnDefinition x:Name="RightSideOfMotherGrid" Width="250"/>
        </Grid.ColumnDefinitions>
        <Grid x:Name="LeftGridInMotherGrid" Margin="10" Panel.ZIndex="-1">
            <Grid.RowDefinitions>
                <RowDefinition/>
            </Grid.RowDefinitions>
            <StackPanel x:Name="MainMenuStackPanel" Margin="0,0,0,126" IsEnabled="False">
                <Button x:Name="ChangeAdminButton" Content="Change Admin" Height="30" Padding="1" FontSize="14" Click="ChangeAdminButton_Click" ToolTip="Change the admin on the selected project"/>
                <Button x:Name="CreateProjectButton" Content="Create Project" Height="30" Click="CreateProjectButton_Click" Padding="1" FontSize="14" ToolTip="Create a new project"/>
                <Button x:Name="CreateTaskButton" Content="Create Tasks" Height="30" Click="CreateTaskButton_Click" FontSize="14" ToolTip="Create tasks in the selected project"/>
                <Button x:Name="CreateUserButton" Content="Create User" Height="30" FontSize="14" Click="CreateUserButton_Click" ToolTip="Create a new user"/>
                <Button x:Name="CreateGanttButton" Content="Create Ganttchart" Height="30" FontSize="14" Click="CreateGanttButton_Click" ToolTip="Create a Gantt-chart from selected project"/>
                <Separator Height="20" Margin="0"/>
                <Label x:Name="ActiveProject" Content="Active Project" FontSize="14" Margin="35,0,0,0" HorizontalAlignment="Left" Width="109"/>
                <ComboBox x:Name="ProjectComboBox" DisplayMemberPath="ProjectName" ItemsSource="{Binding}" IsEditable="False" IsReadOnly="True" Text="Selected project" ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.CanContentScroll="True" ToolTip="Select a project" FontSize="14" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Center" Margin="0" DropDownOpened="ProjectComboBox_DropDownOpened" IsSynchronizedWithCurrentItem="False" SelectionChanged="ProjectComboBox_SelectionChanged" />
                <Label x:Name="ProjectInfoLabel" Content="" ToolTip="Information about the selected project"/>
            </StackPanel>
            <Grid x:Name="ConnectGrid" Margin="0,396,0,0">
                <Button x:Name="ConnectButton" Content="Connect" HorizontalAlignment="Left" Width="90" Click="ConnectButton_Click" Height="27" VerticalAlignment="Bottom" ToolTip="Connect to server"/>
                <Button x:Name="DisconnectButton" Content="Disconnect" IsEnabled="False" Click="DisconnectButton_Click" Height="27" VerticalAlignment="Bottom" Margin="95,0,0,-1" ToolTip="Disconnect from server"/>
                <TextBox x:Name="ServerIPTextBox" TextWrapping="Wrap" Text="127.0.0.1" Margin="0,0,55,92" Height="25" VerticalAlignment="Bottom" GotFocus="ServerIPTextBox_GotFocus" LostFocus="ServerIPTextBox_LostFocus" ToolTip="Enter IP of server" TabIndex="1"/>
                <TextBox x:Name="UsernameTextBox" Margin="0,0,10,62" TextWrapping="Wrap" Text="Username" Height="25" VerticalAlignment="Bottom" GotFocus="UsernameTextBox_GotFocus" LostFocus="UsernameTextBox_LostFocus" ToolTip="Enter username" TabIndex="3"/>
                <PasswordBox x:Name="PasswordPasswordBox" HorizontalAlignment="Left" Width="170" Password="Password" FontFamily="Segoe UI" GotFocus="PasswordPasswordBox_GotFocus" LostFocus="PasswordPasswordBox_LostFocus" ToolTip="Enter password" TabIndex="4" Margin="0,0,0,32" Height="25" VerticalAlignment="Bottom"/>
                <TextBox x:Name="ServerPortTextBox" Height="25" TextWrapping="Wrap" Text="8100" VerticalAlignment="Bottom" ToolTip="Enter port of server" GotFocus="ServerPortTextBox_GotFocus" LostFocus="ServerPortTextBox_LostFocus" TabIndex="2" Margin="130,0,10,92"/>
            </Grid>
        </Grid>
        <Grid x:Name="MiddleGridInMotherGrid" Grid.Column="1" Margin="10" Panel.ZIndex="-1">
            <Grid.RowDefinitions>
                <RowDefinition Height="30"/>
                <RowDefinition/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>
            <DataGrid x:Name="TaskList" Margin="0" Grid.RowSpan="2" RowHeight="20" CanUserResizeColumns="False" CanUserResizeRows="True" AutoGenerateColumns="False" ItemsSource="{Binding}">
                <DataGrid.Columns>
                    <DataGridTextColumn Header="Name" Width="4*" Binding="{Binding TaskName}"/>
                    <DataGridTextColumn Header="Start" Width="2*" Binding="{Binding TaskStart, StringFormat =\{0:d\}}"/>
                    <DataGridTextColumn Header="End" Width="2*" Binding="{Binding TaskEnd, StringFormat=\{0:d\}}"/>
                    <DataGridTextColumn Header="Description" Width="8*" Binding="{Binding TaskDescription}"/>
                    <DataGridCheckBoxColumn Header="Done" Width="40"/>
                </DataGrid.Columns>
            </DataGrid>
        </Grid>
        <Grid x:Name="RightGridInMotherGrid" Grid.Column="2" Margin="10" IsEnabled="False" Panel.ZIndex="-1">
            <Grid.ColumnDefinitions>
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition/>
            </Grid.RowDefinitions>
            <TextBox x:Name="ChatMessageTextBox" FontSize="13" MaxLength="511" Margin="1,0,49.2,0" TextWrapping="Wrap" Text="Enter a chatmessage" SpellCheck.IsEnabled="True" ToolTip="Enter a chatmessage" UndoLimit="500" ClipToBounds="True" GotFocus="ChatMessageTextBox_GotFocus" LostFocus="ChatMessageTextBox_LostFocus" TabIndex="5" Height="40" VerticalAlignment="Bottom"/>
            <Button x:Name="SendChatMessageButton" Content="Send" Margin="0,0,0.2,0" ToolTip="Send chatmessage" Click="SendChatMessageButton_Click" HorizontalAlignment="Right" Width="44" Height="40" VerticalAlignment="Bottom"/>
            <TextBox x:Name="ChatTextBox" FontSize="13" VerticalScrollBarVisibility="Auto" AcceptsReturn="True"  IsReadOnly="True" Margin="0,0,0.2,45.2" TextWrapping="Wrap" ToolTip="Incoming messages" ClipToBounds="True" AllowDrop="False" TabIndex="2147483633" TextChanged="ChatTextBox_TextChanged" />
        </Grid>
        <StackPanel x:Name="NotificationGrid" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="25,70,23,10" Orientation="Vertical" Panel.ZIndex="1" Grid.Column="1" ClipToBounds="True">
            <Grid x:Name="NotifCreateUser" Panel.ZIndex="2" Height="165" Width="200" Margin="10" Visibility="Collapsed" IsEnabled="False">
                <Grid.Background>
                    <SolidColorBrush Color="{DynamicResource {x:Static SystemColors.GradientActiveCaptionColorKey}}"/>
                </Grid.Background>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition/>
                    <ColumnDefinition/>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="33"/>
                    <RowDefinition Height="80.6"/>
                    <RowDefinition/>
                </Grid.RowDefinitions>
                <TextBlock TextWrapping="Wrap" Text="Create User" FontSize="18" TextAlignment="Center" Grid.ColumnSpan="2" FontWeight="Bold" Padding="0,10,0,0" Margin="0"/>
                <StackPanel HorizontalAlignment="Left" Width="200" Margin="0,5,0,0" Grid.ColumnSpan="2" Grid.Row="1" Height="70" VerticalAlignment="Bottom">
                    <TextBox x:Name="NotifCreateUserUsernameTextbox" MaxLength="255" Height="30" TextWrapping="Wrap" Text="Username" Margin="10,0" FontSize="14" Padding="1" VerticalContentAlignment="Center" GotFocus="NotifCreateUserUsernameTextbox_GotFocus" LostFocus="NotifCreateUserUsernameTextbox_LostFocus"/>
                    <PasswordBox x:Name="NotifCreateUserPasswordPasswordBox" Password="Password" MaxLength="255" Margin="10,10,10,0" Height="30" FontSize="14" Padding="1" VerticalContentAlignment="Center" LostFocus="NotifCreateUserPasswordPasswordBox_LostFocus" GotFocus="NotifCreateUserPasswordPasswordBox_GotFocus"/>
                </StackPanel>
                <Button x:Name="NotifCreateUserAddButton" Content="Create" HorizontalAlignment="Left" Margin="10,10,0,0" Grid.Row="2" Width="80" Height="30" VerticalAlignment="Top" Padding="1" Click="NotifCreateUserAddButton_Click"/>
                <Button x:Name="NotifCreateUserCancelButton" Content="Cancel" Grid.Column="1" HorizontalAlignment="Left" Margin="10,10,0,0" Grid.Row="2" VerticalAlignment="Top" Width="80" Height="30" Click="NotifCreateUserCancelButton_Click"/>
            </Grid>
            <Grid x:Name="NotifCreateProject" Margin="10" MinHeight="250" Panel.ZIndex="2" Width="200" Height="250" Visibility="Collapsed" IsEnabled="False">
                <Grid.RowDefinitions>
                    <RowDefinition/>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition/>
                    <ColumnDefinition/>
                </Grid.ColumnDefinitions>
                <Grid.Background>
                    <SolidColorBrush Color="{DynamicResource {x:Static SystemColors.GradientActiveCaptionColorKey}}"/>
                </Grid.Background>
                <TextBlock Margin="10,10,9,0" TextWrapping="Wrap" VerticalAlignment="Top" Height="30" FontSize="18" TextAlignment="Center" FontWeight="Bold" MinWidth="180" Grid.ColumnSpan="2"><Run Language="da-dk" Text="Create Project"/></TextBlock>
                <StackPanel Margin="10,45,10,44.6" Grid.ColumnSpan="2">
                    <TextBox x:Name="NotifCreateProjectProjectNameTextBox" MaxLength="255" TextWrapping="Wrap" Text="Enter project name" Padding="0" Margin="0,5,0,0" ToolTip="Indtast navn på projektet" GotFocus="NotifCreateProjectProjectNameTextBox_GotFocus" LostFocus="NotifCreateProjectProjectNameTextBox_LostFocus" Panel.ZIndex="-4" Height="25.6"/>
                    <Label Content="Select a start date" Margin="0,10,0,0" FontStyle="Italic"/>
                    <DatePicker x:Name="NotifCreateProjectStartDT" Text="Test" FirstDayOfWeek="Monday" SelectedDateFormat="Short" Margin="0" ToolTip="Vælg en startdato for projektet" IsTodayHighlighted="True" SelectedDateChanged="NotifCreateProjectStartDT_SelectedDateChanged"/>
                    <Label Content="Select a end date" Margin="0,10,0,0" FontStyle="Italic"/>
                    <DatePicker x:Name="NotifCreateProjectEndDT" Margin="0" SelectedDateFormat="Short" ToolTip="Vælg en slutdato for projektet"/>
                </StackPanel>
                <Button x:Name="NotifCreateProjectAddButton" Content="Add" Margin="9,210,10.2,0" Click="NotifCreateProjectAddButton_Click" Height="30" VerticalAlignment="Top"/>
                <Button x:Name="NotifCreateProjectCancelButton" Content="Cancel" Margin="9.8,210,10,0" Click="NotifCreateProjectCancelButton_Click" Height="30" VerticalAlignment="Top" Grid.Column="1"/>
            </Grid>
            <Grid x:Name="NotifCreateTask" Margin="10" MinWidth="200" MinHeight="300" Height="341" Panel.ZIndex="2" Width="200" Visibility="Collapsed" IsEnabled="False">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition/>
                    <ColumnDefinition/>
                </Grid.ColumnDefinitions>
                <Grid.Background>
                    <SolidColorBrush Color="{DynamicResource {x:Static SystemColors.GradientActiveCaptionColorKey}}"/>
                </Grid.Background>
                <TextBlock Margin="10,10,10,0" TextWrapping="Wrap" VerticalAlignment="Top" Height="30" FontSize="18" TextAlignment="Center" FontWeight="Bold" Grid.ColumnSpan="2"><Run Language="da-dk" Text="Create Task"/></TextBlock>
                <StackPanel Margin="10,45,10,0" VerticalAlignment="Top" Grid.ColumnSpan="2" Height="231">
                    <TextBox x:Name="NotifCreateTaskTaskNameTextBox" MaxLength="255" TextWrapping="Wrap" Text="Enter task name" Padding="0" VerticalAlignment="Center" GotFocus="NotifCreateTaskTaskNameTextBox_GotFocus" LostFocus="NotifCreateTaskTaskNameTextBox_LostFocus" Height="25"/>
                    <Label Content="Select a start date" Margin="0,10,0,0" FontStyle="Italic"/>
                    <DatePicker x:Name="NotifCreateTaskStartDT" FirstDayOfWeek="Monday" SelectedDateFormat="Short" Margin="0" ToolTip="Vælg en startdato for projektet" IsTodayHighlighted="True" SelectedDateChanged="NotifCreateTaskStartDT_SelectedDateChanged"/>
                    <Label Content="Select a end date" Margin="0,10,0,0" FontStyle="Italic"/>
                    <DatePicker x:Name="NotifCreateTaskEndDT" Margin="0" SelectedDateFormat="Short" ToolTip="Vælg en slutdato for projektet"/>
                    <TextBox x:Name="NotifCreateTaskTaskDescriptionTextBox" MaxLength="255" Height="75" TextWrapping="Wrap" Text="Enter task description" Margin="0,10,0,0" GotFocus="NotifCreateTaskTaskDescriptionTextBox_GotFocus" LostFocus="NotifCreateTaskTaskDescriptionTextBox_LostFocus" SpellCheck.IsEnabled="True"/>
                </StackPanel>
                <Button x:Name="NotifCreateTaskAddButton" Content="Add" VerticalAlignment="Bottom" Margin="10,0,10,10" Height="30" Click="NotifCreateTaskAddButton_Click"/>
                <Button x:Name="NotifCreateTaskCancelButton" Content="Close" VerticalAlignment="Bottom" Margin="10,0,10,10" Height="30" Grid.Column="1" Click="NotifCreateTaskCancelButton_Click" />
            </Grid>
            <Grid x:Name="NotifChangeAdmin" Height="121" Width="200" Visibility="Collapsed" Margin="10" IsEnabled="False">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition/>
                    <ColumnDefinition/>
                </Grid.ColumnDefinitions>
                <Grid.Background>
                    <SolidColorBrush Color="{DynamicResource {x:Static SystemColors.GradientActiveCaptionColorKey}}"/>
                </Grid.Background>
                <TextBlock TextWrapping="Wrap" Margin="10,10,10,0" FontSize="18" TextAlignment="Center" Height="24" VerticalAlignment="Top" Grid.ColumnSpan="2" FontWeight="Bold"><Run Language="da-dk" Text="Change admin"/></TextBlock>
                <TextBox x:Name="NotifChangeAdminUsernameTextBox" Height="23" MaxLength="255" TextWrapping="Wrap" Text="Admin name" VerticalAlignment="Top" Margin="10,39,10,0" FontSize="14" Grid.ColumnSpan="2" GotFocus="NotifChangeAdminUsernameTextBox_GotFocus" LostFocus="NotifChangeAdminUsernameTextBox_LostFocus"/>
                <Button x:Name="NotifChangeAdminAdd" Content="Change" Margin="10,77,15,14" Click="NotifChangeAdminAdd_Click"/>
                <Button x:Name="NotifChangeAdminCancel" Content="Cancel" Grid.Column="1" Margin="10,76,10,15" Click="NotifChangeAdminCancel_Click"/>
            </Grid>
        </StackPanel>
        <Grid x:Name="Gantt" Grid.ColumnSpan="3" Margin="0" ClipToBounds="True" UseLayoutRounding="True" SizeChanged="Gantt_SizeChanged" IsEnabled="False" Visibility="Collapsed">
            <Grid.Background>
                <LinearGradientBrush EndPoint="0.5,1" MappingMode="RelativeToBoundingBox" StartPoint="0.5,0">
                    <GradientStop Color="Black"/>
                    <GradientStop Color="#FF94C1F2" Offset="0.075"/>
                </LinearGradientBrush>
            </Grid.Background>
            <Grid.RowDefinitions>
                <RowDefinition Height="48"/>
                <RowDefinition/>
            </Grid.RowDefinitions>
            <Button x:Name="GanttCloseButton" Content="Close" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Width="80" Height="28" Click="GanttCloseButton_Click" UseLayoutRounding="True"/>
            <ScrollViewer x:Name="GanttScrollviewer" Margin="0" Grid.Row="1"  HorizontalScrollBarVisibility="Visible" VerticalScrollBarVisibility="Visible" HorizontalAlignment ="Stretch" VerticalAlignment="Stretch" UseLayoutRounding="True">
                <Canvas x:Name="TaskCanvas" ClipToBounds="True" SnapsToDevicePixels="True" Background="#FF94C1F2" MinWidth="1" MinHeight="1" HorizontalAlignment="Left" UseLayoutRounding="True"/>
            </ScrollViewer>
        </Grid>
        <Grid x:Name="HelpGrid" Margin="0" Grid.ColumnSpan="3" Visibility="Collapsed" IsEnabled="False">
            <WebBrowser x:Name="HelpBrowser" Margin="0" Source="{x:Null}"/>
        </Grid>
    </Grid>
</Window>
